<?php
	$masv=$_GET['sv_ID'];
	 	$sql_getall="select * from sinhvien where masv=$masv";
		$r=mysql_query($sql_getall);
		$nr=mysql_fetch_array($r);	
		
?>
<div class="title">Sửa Thông Tin Sinh Viên</div>
<div class="frm" >
	<table border="0" width="800">
	<form action="sinhvien/sua_sinhvien_action.php" method="post" name="frm" enctype="multipart/form-data">    	           
    	<tr><td align="left">Mã sinh viên<b style="color:#F00">(*)</b>:</td>
        <td><input type="text" name="txt_masv"/ value="<?php echo $masv; ?>" readonly="readonly"></td></tr>
        <tr><td align="left">Họ tên sinh viên<b style="color:#F00">(*)</b>:</td><td><input type="text" name="txt_hoten" value="<?php echo $nr['hoten'] ?>"/></td></tr>
         <tr><td align="left">Ngày sinh<b style="color:#F00">(*)</b>:</td><td><input type="date" name="txt_ngaysinh" value="<?php echo $nr['ngaysinh'] ?>"/></td></tr>
         <tr><td align="left">Giới tính<b style="color:#F00">(*)</b>:</td><td><select name="gender">
         						<option value="1">Nam</option>
                                <option value="0">Nữ</option></td></tr>
          <tr><td align="left">Quê quán<b style="color:#F00">(*)</b>:</td><td><input type="text" name="txt_quequan" size="50" value="<?php echo $nr['quequan'] ?>"/></td></tr>
           <tr><td align="left">Dân tộc<b style="color:#F00">(*)</b>:</td><td><select name="dantoc">
         						<option value="kinh" <?php if($nr['dantoc'] =="kinh") echo "selected='selected'" ; ?>>Kinh</option>
                                <option value="chut" <?php if($nr['dantoc'] =="chut") echo "selected='selected'" ; ?>>Chứt</option>
                                <option value="muong" <?php if($nr['dantoc'] =="muong") echo "selected='selected'" ; ?>>Mường</option>
                                <option value="tho"<?php if($nr['dantoc'] =="tho") echo "selected='selected'" ; ?>>Thổ</option>
                                <option value="tay"<?php if($nr['dantoc'] =="tay") echo "selected='selected'" ; ?>>Tày</option>
                                <option value="thai"<?php if($nr['dantoc'] =="thai") echo "selected='selected'" ; ?>>Thái</option>
                                <option value="khome"<?php if($nr['dantoc'] =="khome") echo "selected='selected'" ; ?>>Khơ me</option>
                                <option value="bana"<?php if($nr['dantoc'] =="bana") echo "selected='selected'" ; ?>>Bana</option>
                                <option value="dao"<?php if($nr['dantoc'] =="dao") echo "selected='selected'" ; ?>>Dao</option></td></tr>
          <tr><td align="left">Lớp<b style="color:#F00">(*)</b>:</td><td><input type="text" name="txt_lop" value="<?php echo $nr['lop'] ?>"/></td></tr>
          <tr><td align="left">Khoa<b style="color:#F00">(*)</b>:</td><td><input type="text" name="txt_khoa" value="<?php echo $nr['khoa'] ?>"/></td></tr>
          <tr><td align="left">Niên khóa<b style="color:#F00">(*)</b>:</td><td><input type="text" name="txt_nienkhoa" value="<?php echo $nr['nienkhoa'] ?>"/></td></tr>
          <tr><td align="left">Số chứng minh<b style="color:#F00">(*)</b>:</td><td><input type="text" name="txt_socm" value="<?php echo $nr['socm'] ?>"/></td></tr>
          <tr><td align="left">Điện thoại<b style="color:#F00">(*)</b>:</td><td><input type="text" name="txt_dienthoai" value="<?php echo $nr['sodt'] ?>"/></td></tr>
            <tr><td align="left">Hình ảnh<b style="color:#F00">(*)</b>:</td>
            <td><input type="file" name="img" value="<?php echo $nr['anh'];?>" /></td></tr>
       	  <tr><td colspan="2"  align="center"><input type="submit" value="Update" onclick="return check()" /></td></tr>					
    </form>
    </table>
</div>
<a href="./?mod=sinhvien&do=dssv" style="margin-top:50px; font-size:18px;">Quay lại</a>
<script language="javascript">

   		function check()
		{
			var mss="Thiếu thông tin, vui lòng kiểm tra lại!";
			reg = /[^0-9]/;			
			if(window.document.frm.txt_masv.value=="")
			{
				alert(mss);window.document.frm.txt_masv.focus();return false;
			}else if(reg.test(document.frm.txt_masv.value) ==true)
			{
				alert("Mã sinh viên phải là số");window.document.frm.txt_masv.focus();return false;
			}else if(window.document.frm.txt_hoten.value=="")
			{
				alert(mss);window.document.frm.txt_hoten.focus(); return false;
			}else if(window.document.frm.txt_quequan.value=="")
			{
				alert(mss);window.document.frm.txt_quequan.focus(); return false;
			}
			else if(window.document.frm.txt_lop.value=="")
			{
				alert(mss);window.document.frm.txt_lop.focus(); return false;
			}
			else if(window.document.frm.txt_khoa.value=="")
			{
				alert(mss);window.document.frm.txt_khoa.focus(); return false;
			}else if(window.document.frm.txt_nienkhoa.value=="")
			{
				alert(mss);window.document.frm.txt_nienkhoa.focus(); return false;
			}else if(window.document.frm.txt_socm.value=="")
			{
				alert(mss);window.document.frm.txt_socm.focus(); return false;
			}else if(reg.test(window.document.frm.txt_socm.value)==true)
			{
				alert("Số chứng minh thư phải là số");window.document.frm.txt_socm.focus(); return false;
			}
			else if(window.document.frm.cb.checked==false)
			{
				alert("bạn phải tích vào ô chắc chắn");return false;
			}
			return true;
		}
   </script>